<?php
declare (strict_types=1);

namespace app\content\service\content;

use app\common\service\BaseService;
use app\content\logic\content\Single as SingleLogic;
use think\facade\View;

/**
 * 单页管理
 */
class Single extends BaseService
{
    public function fetch(int $type, int $id)
    {
        $data = app(SingleLogic::class)->fetch($type, $id);

        return $this->parseToData($data, 1, '获取成功');
    }

    public function content(int $type, int $id)
    {
        $info = app(SingleLogic::class)->content($type, $id);

        View::assign('title', $info->title);
        view::assign('content', $info->content);

        return View::fetch('single/content');
    }
}
